﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;

namespace TweetMemeNET
{
    /// <summary>
    /// Represents a result set containing tweets
    /// </summary>
    public class TweetMemeResultTweets : TweetMemeResultBase, ITweetMemeResult
    {
        public TweetMemeResultTweets(string xml)
            : base(xml)
        {

        }

        protected override void ParseResultXml()
        {
            Tweets = new List<Tweet>();

            foreach (XElement tweet in GetResultElement().Element(XName.Get("tweets", string.Empty)).Elements(XName.Get("tweet",string.Empty)))
            {
                Tweets.Add(new Tweet(tweet));
            }
        }

        /// <summary>
        /// Gets a list of individual Tweets, including information about the Twitter user
        /// </summary>
        public List<Tweet> Tweets { get; protected set; }
    }
}